package modelo;

public class Oscilador extends Thread{
	private boolean clock;
	private int i;
	private SMailbox t1 = new SMailbox();
	private SMailbox t2 = new SMailbox();
	private SMailbox t3 = new SMailbox();
	private int modoDeOp;
	
	public Oscilador(SMailbox t1, SMailbox t2, SMailbox t3, int modoDeOp){
		this.t1= t1;
		this.t2 = t2;
		this.t3 = t3;
		this.modoDeOp = modoDeOp;
	}
	public boolean isClock() {
		return clock;
	}
	
	public void run(){
		while(true){
			try{
				sleep(10000);
				if(i==0){
					t1.send(1);
					t2.send(0);
					t3.send(0);
					t3.send(0);
					t3.send(0);
					t3.send(0);
					i++;
				}else if(i==1){
					t1.send(0);
					t2.send(1);
					t3.send(0);
					t3.send(0);
					t3.send(0);
					t3.send(0);
					i++;
				}else{
					t1.send(0);
					t2.send(1);
					t3.send(0);
					t3.send(0);
					t3.send(0);
					t3.send(0);
					i=0;
				}
			}catch(InterruptedException e){}
		} 
	}
}
